{include file="common/header" /}

        <section class="content-header">
          <h1>{$venue}预约列表</h1>
          <ol class="breadcrumb">
            <li><a href="../"><i class="fa fa-home"></i> 首页</a></li>
            <li class="active">场馆预约</li>
            <li class="active">{$venue}预约列表</li>
          </ol>
        </section>

        <section class="content">

          <div class="row">
            <div class="col-xs-12">
              <div class="box">
                <div class="box-header">
                  <h3 class="box-title">
                      <a href="/admin/venreserve/index" ><span class="label label-back" onclick='goback()'><i class="fa fa-chevron-left"></i> 返回</span></a>
                  </h3>
				  <div class="box-tools">
                   <form class="form-inline" name="form1" method="get" id="form1">
						<input type='hidden' name="pid" value="{$_GET['pid']}" />
						<div class="form-group">
							<select name="groupaid" id="groupaid" class="form-control input-sm" onChange="chggroupb(this.value);">
								<option value="">--单位--</option>
								{volist name="groupa" id="vo"}
								<option value="{$vo.id}"{if condition="$vo.id eq $_GET.groupaid"} selected="selected"{/if}>{$vo.title}</option>
								{/volist}
							</select>
						</div>
						<div class="form-group">
							<select name="groupbid" id="groupbid" class="form-control input-sm">
								<option value="">----</option>
								{volist name="groupb" id="vo"}
								<option value="{$vo.id}"{if condition="$vo.id eq $_GET.groupbid"} selected="selected"{/if}>{$vo.title}</option>
								{/volist}
							</select>
						</div>
						<div class="form-group">
							<input name="dateinfo" id="dateinfo" type="text" value="{$_GET.dateinfo}" style="width:100px" class="form-control input-sm" autocomplete="off" placeholder="预约时间" />
						</div>
						<div class="form-group">
							<select name="datetime" class="form-control input-sm">
								<option value="">--开放时间表--</option>
								{volist name="opentimes" id="vo"}
								<option value="{$vo.dateinfo}"{if condition="$vo.dateinfo eq $_GET.datetime"} selected="selected"{/if}>{$vo.dateinfo}</option>
								{/volist}
							</select>
						</div>
						<div class="input-group" style="width: 150px;">
							<input type="text" name="keyword" value="{$_GET.keyword}" class="form-control input-sm pull-right" placeholder="预约人姓名...">
							<div class="input-group-btn">
								<button type="submit" class="btn btn-sm btn-default"><i class="fa fa-search"></i></button>
								<button type="submit" name='export' value="1" class="btn btn-sm btn-default" title="导出" ><i class="fa fa-cloud-download" aria-hidden="true"></i></button>
							</div>
						</div>
                    </form>
                  </div>
                </div>
                <div class="box-body table-responsive no-padding">
					<table class="table table-hover" cellspacing="0" border="0" style="border-width:0px;border-collapse:collapse;">
					<tr>
						<th scope="col">序号</th>
						<th scope="col">开放活动</th>
						<th scope="col">预约人</th>
						<th scope="col">预约人手机</th>
						<th scope="col">单位</th>
						<th scope="col">预约时间</th>
						<th scope="col">是否携带家属</th>
						<th scope="col">预约人次</th>
						<th scope="col">下单时间</th>
						<th scope="col">核销时间</th>
						<th scope="col">操作</th>
					</tr>
					{volist name="list" id="vo"}
					<tr id="tr_{$vo.id}">
						<td class="id">{$i|getPageNumber}</span></td>
						<td>{$vo.opentitle}</td>
						<td>{$vo.username}</td>
						<td>{$vo.telephone}</td>
						<td>{:getGroupName($vo.groupaid,$vo.groupbid,$vo.groupcid)}</td>
						<td>{$vo.dateinfo}（{:getWeekName($vo.dateinfo)}）{$vo.datetime}</td>
						<td>{if $vo.family eq 1}是{else}否{/if}</td>
						<td>{$vo.usernumber}</td>
						<td>{$vo.add_time|getDateTime}</td>
						<td>{$vo.completed_time|getDateTime}</td>
						<td>
							<a onclick="funChange({$vo.id});" href="javascript:;" ><span class="label label-danger"><i class="fa fa-remove"></i> 删除</span></a>
						</td>
					</tr>
					{/volist}
					</table>
                </div>
				<div id="pager">
                <!--分页-->
                    {$list -> render()}
				</div>
              </div>
            </div>
          </div>
           
        </section>
<script src="/layui/layer.js"></script>
<script src="/plugins/laydate/laydate.js"></script>	
<script type="text/javascript">
laydate.render({
	elem: '#dateinfo',
	type: 'date',
	format: 'yyyy-MM-dd'
});

var subcat = new Array();
{volist name="groupbarr" id="vo"}
subcat[{$key}] = new Array('{$vo.groupid}','{$vo.title}','{$vo.id}')
{/volist}
	
function chggroupb(aid)
{	
	document.form1.groupbid.length = 0;
	document.form1.groupbid.options[0] = new Option('----','');
	for (i=0; i<subcat.length; i++)
	{
	if (subcat[i][0] == aid)
	{document.form1.groupbid.options[document.form1.groupbid.length] = new Option(subcat[i][1], subcat[i][2]);}
	}
}

function funChange(id){
	layer.confirm('确认要删除吗', {icon: 3}, function(){
		$.ajax({
			type: "GET",
			dataType: "json",
			url: '/admin/venreserve/record_del',
			data: {"delid":id},
			async: false,
			success: function(data) {
			  if(data == 1){
				layer.msg('删除成功');
				$('#tr_'+id).hide();
			  }else if(data == 2){
				layer.msg('没有权限删除');
			  }else{
				layer.msg('操作失败'+data);
			  }
			},
			error: function(){
			  layer.msg('系统错误！请稍后访问');
			}
	  });
  });
}
</script>
{include file="common/footer" /}
